package com.jumi.microservice.service;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.SimpleHttpConnectionManager;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.params.HttpMethodParams;

public class
CeshiService {
    public static String faPiao() {
        String SendUrl = "https://nnfpdev.jss.com.cn/shop/buyer/allow/ecOd/queryElectricKp.action";
        String order ="{\n" +
                "    \"identity\":\"93363DCC6064869708F1F3C72A0CE72A713A9D425CD50CDE\",\n" +
                "    \"fpqqlsh\":[\n" +
                "        \"20170104160449979446\"\n" +
                "    ]\n" +
                "}";
        order = DESDZFP.encrypt(order);
        HttpClient httpclient = null;
        PostMethod post = null;
        String info = "";
        try {
            httpclient = new HttpClient();
            post = new PostMethod(SendUrl);//设置编码方式
            post.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, "UTF-8");//添加参数
            post.addParameter("order", order);//执行
            httpclient.executeMethod(post);//接口返回信息
            info = new String(post.getResponseBody(), "UTF-8");
            System.out.println(info);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {//关闭连接，释放资源
            post.releaseConnection();
            ((SimpleHttpConnectionManager) httpclient.getHttpConnectionManager()).shutdown();
        }
        return info;
    }

    public static void main(String[] args) {
        faPiao();
    }
}
